<?php
/*
	插件概览
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
if($_RQ['op']=='get'){
	$merchs=pdo_getall('jy_merch_user',array('uniacid'=>$_SESSION['uniacid']),array('id','pcd','status','is_yajinfee'));
	$datas=array();
	$datas[0]=array('product','待审核','未交赞助金','已入驻');
	$datas2['titles']=array('待审核','未交赞助金','已入驻');
	$pcddata=array();
	foreach($merchs as $mv){
		$pcd=json_decode($mv['pcd'],true);
		if($pcd['province']){
			$pcddata[$pcd['province']][0]=$pcddata[$pcd['province']][0]?:$pcd['province'];
			$datas2['datas'][$pcd['province']]['title']=$pcd['province'];
			$pcddata[$pcd['province']][1]=$pcddata[$pcd['province']][1]?:0;
			$pcddata[$pcd['province']][2]=$pcddata[$pcd['province']][2]?:0;
			$pcddata[$pcd['province']][3]=$pcddata[$pcd['province']][3]?:0;
			$datas2['datas'][$pcd['province']]['values'][1]=$datas2['datas'][$pcd['province']]['values'][1]?:0;
			$datas2['datas'][$pcd['province']]['values'][2]=$datas2['datas'][$pcd['province']]['values'][2]?:0;
			$datas2['datas'][$pcd['province']]['values'][3]=$datas2['datas'][$pcd['province']]['values'][3]?:0;
			if(!$mv['status']){
				$pcddata[$pcd['province']][1] +=1;
				$datas2['datas'][$pcd['province']]['values'][1] +=1;
			}elseif($mv['status']==3){
				$pcddata[$pcd['province']][2] +=1;
				$datas2['datas'][$pcd['province']]['values'][2] +=1;
			}elseif($mv['status']==1){
				$pcddata[$pcd['province']][3] +=1;
				$datas2['datas'][$pcd['province']]['values'][3] +=1;
			}
		}
	}
	$pcddata=array_values($pcddata);
	foreach($pcddata as $data){
		$datas[]=$data;
	}
	$htmls=array(
		array('type'=>'echarts_zu','width'=>'50%','ecid'=>'pcd','title'=>'数据概况','datas'=>array(
			'datas'=>$datas,
		)),
		array('type'=>'echarts_table','width'=>'50%','ecid'=>'table','title'=>'数据明细','datas'=>array(
			'datas'=>$datas2,
		)),
	);
	$return['htmls']=$htmls;
	exi($return);
}